﻿<phone:PhoneApplicationPage
    x:Class="GNP.CategoryPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Common="clr-namespace:GNP.Common" FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    d:DataContext="{Binding Main.Categories[0],Source={StaticResource Locator}}"
    
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot est la grille racine où tout le contenu de la page est placé-->
    <Grid x:Name="LayoutRoot" >
        <Grid.Background>
            <SolidColorBrush Color="#FF616161" />
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contient le nom de l'application et le titre de la page-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="{Binding Title}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - placez tout contenu supplémentaire ici-->
        <Grid x:Name="ContentPanel" Grid.Row="1" toolkit:TiltEffect.IsTiltEnabled="True" Margin="12,0,12,0">
            <ListBox ItemsSource="{Binding Items}" SelectionChanged="ListBox_SelectionChanged" >
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel  />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Common:HighlightTemplateSelector Content="{Binding}">
                            <Common:HighlightTemplateSelector.FirstItem >
                                <DataTemplate>
                                    <Grid  Height="150" Width="420" >
                                        <Image Source="{Binding ImageLink}" Stretch="UniformToFill"  Height="150" Width="420"/>
                                        <StackPanel Background="#50000000" VerticalAlignment="Bottom">
                                            <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Margin="10" Style="{StaticResource PhoneTextSubtleStyle}" MaxHeight="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </Common:HighlightTemplateSelector.FirstItem>
                            <Common:HighlightTemplateSelector.OtherItems>
                                <DataTemplate>
                                    <Grid  Height="150" Width="200" Margin="0,20,20,10">
                                        <Image Source="{Binding ImageLink}" Stretch="UniformToFill"  Height="150" Width="200"/>
                                        <StackPanel Background="#50000000" VerticalAlignment="Bottom">
                                            <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Margin="10" Style="{StaticResource PhoneTextSubtleStyle}" MaxHeight="80" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </Common:HighlightTemplateSelector.OtherItems>
                        </Common:HighlightTemplateSelector>
                    </DataTemplate>

                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>